//
//  BackGroundImageView.m
//  WestAir
//
//  Created by zhouChaoLin on 16/10/27.
//  Copyright © 2016年 Henry. All rights reserved.
//

#import "BackGroundImageView.h"

@implementation BackGroundImageView



- (void)layoutSubviews{
    [super layoutSubviews];
    
    
    CGFloat corner = BUTTONCORNER_R;
    CAShapeLayer *shapeLayer = [CAShapeLayer layer];
    if (self.type==cornerTopLeftAndRight) {
          shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight  cornerRadii:CGSizeMake(corner, corner)].CGPath;
    }
    else if(self.type==cornerBottomLeftAndRight){
      shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:  UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(corner, corner)].CGPath;
    }
    else{
    
       shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:  UIRectCornerAllCorners cornerRadii:CGSizeMake(0, 0)].CGPath;
    }
  
    self.layer.mask = shapeLayer;
}
@end
